﻿<Window x:Class="SystemsAdmin.SystemsAdminWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Systems Admin" Height="468" Width="401">



    <Grid DataContext="{Binding}" Height="410">
        <Grid.RowDefinitions>
            <RowDefinition Height="138*" />
            <RowDefinition Height="211.35*" />
            <RowDefinition Height="48.65*" />
        </Grid.RowDefinitions>
        <ListBox Name="ComputersList" DataContext="{Binding}" ItemsSource="{Binding}" SelectionMode="Extended" >
            <ListBox.ItemTemplate>
                <DataTemplate>



                    <Grid Margin="3">
                        <Grid.BitmapEffect>
                            <DropShadowBitmapEffect />
                        </Grid.BitmapEffect>
                        <Rectangle Name="ComputerCell"
                            Opacity="1" RadiusX="9" RadiusY="9" 
                            Fill="Blue" StrokeThickness="0.35">


                            <Rectangle.Stroke>


                                <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                    <GradientStop Color="White" Offset="0" />
                                    <GradientStop Color="#666666" Offset="1" />
                                </LinearGradientBrush>
                            </Rectangle.Stroke>
                        </Rectangle>
                        <Rectangle Margin="2,2,2,0"   
      VerticalAlignment="Top"   
      RadiusX="6"   
      RadiusY="6"   
      Stroke="Transparent"   
      Height="15px">
                            <Rectangle.Fill>
                                <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                    <GradientStop Color="#ccffffff" Offset="0" />
                                    <GradientStop Color="transparent" Offset="1" />
                                </LinearGradientBrush>
                            </Rectangle.Fill>
                        </Rectangle>
                        <Grid Margin="5">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="auto"/>
                                <RowDefinition Height="auto"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>

                            <StackPanel  Grid.Row="0" Orientation="Horizontal">
                                <TextBlock FontSize="16" Foreground="White" Text="{Binding Name}" />
                                <TextBlock FontSize="16" Foreground="White" xml:space="preserve"> :</TextBlock>
                                <TextBlock FontSize="16" Foreground="White" Text="{Binding IsON}" />
                            </StackPanel>

                            <StackPanel  Grid.Row="1" Orientation="Horizontal">
                                <TextBlock FontSize="12" Foreground="White" Text="{Binding IPAddress}" />
                                <TextBlock FontSize="12" Foreground="White" xml:space="preserve"> -</TextBlock>
                                <TextBlock FontSize="12" Foreground="White" Text="{Binding MACAddress}" />
                            </StackPanel>
                        </Grid>
                    </Grid>

                    <DataTemplate.Triggers>
                        <DataTrigger Binding="{Binding IsON}" 
          Value="False">
                            <Setter TargetName="ComputerCell" Property="Fill" Value="Red" />
                        </DataTrigger>

                    </DataTemplate.Triggers>
                </DataTemplate>
            </ListBox.ItemTemplate>

        </ListBox>
        <TextBox  Name="txt_output" Grid.Row="2" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" Margin="0,1,0,0" />
        
            <TabControl  Grid.Row="1" Margin="0,0,0,17">
                <TabItem Header="Actions">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="166*" />
                        <ColumnDefinition Width="102*" />
                    </Grid.ColumnDefinitions>
                    <Button Content="Do WOL"  Height="23" HorizontalAlignment="Left" Margin="93,6,0,0" Name="ExecWolButton" VerticalAlignment="Top" Width="75" Click="ExecWolButton_Click" Grid.ColumnSpan="2" />
                    <Button Content="Ping"  Height="23" HorizontalAlignment="Left" Margin="12,6,0,0" Name="PingBtn" VerticalAlignment="Top" Width="75" Click="PingBtn_Click" />
                    <Button Content="Remote Desktop" Height="23" HorizontalAlignment="Left" Margin="8,6,0,0" Name="DoRDP" VerticalAlignment="Top" Width="92" Click="DoRDP_Click" Grid.Column="1" />
                    <Button Content="Refresh" Height="23" HorizontalAlignment="Left" Margin="12,35,0,0" Name="RefreshBtn" VerticalAlignment="Top" Width="75" Click="RefreshBtn_Click" />

                </Grid>
            </TabItem>
                <TabItem Header="Copy Files">
                    <Grid Height="93">

                    <StackPanel  Grid.Row="0" Orientation="Vertical">
                        <StackPanel  Grid.Row="0" Orientation="Horizontal">
                        <Label Content="From" Name="label1"  />
                        <TextBox  Name="CopySourceFiles" Width="187" />
                        <Button Content="Browse"   Name="BrowseSourceFileBtn" Click="BrowseSourceFileBtn_Click" />


                    </StackPanel>

                    <StackPanel  Grid.Row="1" Orientation="Horizontal">
                        <Label Content="To" Name="label2"  />
                        <TextBox  Name="CopyTargetPath" Width="184" />
                        <Button Content="Copy Files" Height="23"  Name="CopyFilesBtn"  Click="CopyFiles_Click" />

                    </StackPanel>
                    </StackPanel>

                </Grid>
                </TabItem>
            <TabItem Header="Copy Folders">
                <Grid Height="93">

                    <StackPanel  Grid.Row="0" Orientation="Vertical">
                        <StackPanel  Grid.Row="0" Orientation="Horizontal">
                            <Label Content="From" Name="label4"  />
                            <TextBox  Name="CopySourceFolders" Width="187" />
                            <Button Content="Browse"   Name="BrowseSourceFolderBtn" Click="BrowseSourceFolderBtn_Click" />


                        </StackPanel>

                        <StackPanel  Grid.Row="1" Orientation="Horizontal">
                            <Label Content="To" Name="label5"  />
                            <TextBox  Name="CopyFolderTargetPath" Width="184" />
                            <Button Content="Copy Folder" Height="23"  Name="CopyFolderBtn"  Click="CopyFolders_Click" />

                        </StackPanel>
                    </StackPanel>

                </Grid>
            </TabItem>
            <TabItem Header="Execute Command">

                <StackPanel Orientation="Vertical" >
                    <TextBlock Height="39" TextWrapping="Wrap" Text="Command to execute with PsExec (will be executed as cmd /c &quot;your command&quot;, any quotes in the command will be escaped.)"></TextBlock>

                    <TextBox  Name="PsExecCommandTxt" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" Height="57" />
                    <TextBlock Height="22" TextWrapping="WrapWithOverflow">Enter Username and Password if the command uses a Network resource</TextBlock>

                    <StackPanel Orientation="Horizontal" >

                         <TextBox  Name="PsExecUser"  Width="132" />
                        <PasswordBox Height="23" Name="PsExecPassword" Width="120" />
                    </StackPanel>
                    <Button Content="Execute" Height="23"  Name="PsExecBtn"  Click="PsExecBtn_Click" Width="268" />

                </StackPanel>
                
            </TabItem>
            </TabControl>
        

    </Grid>

</Window>
